<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>轮播图</title>
    <link rel="shortcut icon" href="../lib/image/favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="../lib/css/all.css">

</head>
<style>
    .slideshow-container {
        position: relative;
        width: 100%;
        height: 300px;
        text-align: center;
    }

    .slide {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        transition: opacity 1s ease-in-out;
    }

    .slide img {
        max-width: 100%;
        max-height: 100%;
    }

    .slide.active {
        opacity: 1;
    }

    .fade {
        animation: fade 3s linear;
    }

    @keyframes fade {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }
</style>

<body>
    <div id="app">
        <div class="slideshow-container">
            <div class="slide active">
                <img src="../lib/image/1.jpg">
            </div>
            <div class="slide">
                <img src="../lib/image/2.jpg">
            </div>
            <div class="slide">
                <img src="../lib/image/3.jpg">
            </div>
        </div>
    </div>
    <script type="text/javascript">
		let slides = document.getElementsByClassName("slide");
		let currentSlide = 0;
		let slideInterval = setInterval(nextSlide, 2000);

		function nextSlide() {
			slides[currentSlide].className = "slide";
			currentSlide = (currentSlide + 1) % slides.length;
			slides[currentSlide].className = "slide active";
		}
	</script>
</body>

</html>